/**
 * OSAmI: Open Source Ambient Intelligence
 * Copyright (C) 2010 Bull S.A.S.
 * Contact: osami-general@osami-commons.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 */

package org.osami.gateway.identity;

import java.util.Date;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: guillaume
 * Date: 28 juil. 2010
 * Time: 18:07:46
 * To change this template use File | Settings | File Templates.
 */
public interface Identity {

    /**
     * Property name that stores the identity human readable name.
     */
    String FRIENDLY_NAME = "identity.friendly.name";

    /**
     * @return Human readable name.
     */
    String getName();

    /**
     * @return the identifier that is bound to the Identity (may be null).
     */
    String getBoundIdentifier();

    /**
     * @return the unique ID of this Identity.
     */
    String getIdentityID();

    /**
     * @return the parent identity (if any) or {@code null} if this identity has no parent.
     */
    Identity getParent();

    /**
     * @return the properties associated with this Identity (with no inheritance).
     */
    Map<String, Object> getProperties();

    /**
     * Returns a merged Map between the properties of this Identity and its parent (if any).
     * Local properties overrides parent's properties.
     * This method returns a new instance each time it is called.
     * @return the properties associated with this Identity (merged with parent's properties if any).
     */
    Map<String, Object> getMergedProperties();

    /**
     * @return the binding state of this Identity.
     */
    State getState();

    /**
     *
     * @return
     */
    Date getCreationDate();

    /**
     * Sets the given property to the given value.
     */
    void addProperty(String name, Object value);

    /**
     * Sets the given property to the given value.
     */
    void changeProperty(String name, Object value);

    /**
     * Put the given properties
     */
    void putProperties(Map<String, Object> properties);

    public static enum State {
        UNBOUND, BOUND
    }
}
